﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.Intrinsics.Arm;
using XinjeMesProgram.Entities.RoleAndUser;

namespace XinjeMesProgram.Entities.User
{
    public class MesUserRole
    {
        /// <summary>
        /// 用户id.
        /// </summary>
        [Key]
        [Column(TypeName = "nvarchar(100)")]
        public string? ID { get; set; }

        /// <summary>
        /// 登录名.
        /// </summary>
        [Column(TypeName ="varchar(50)")]
        public string? LoginName { get; set; }

        /// <summary>
        /// 用户名.
        /// </summary>
        [Column(TypeName = "varchar(50)")]
        public string? UserName { get; set; }

        /// <summary>
        /// 密码.
        /// </summary>
        [Column(TypeName = "varchar(50)")]
        public string? PWD { get; set; }

        /// <summary>
        /// 部门.
        /// </summary>
        [Column(TypeName = "varchar(50)")]
        public string? Dep { get; set; }

        /// <summary>
        /// 等级.
        /// </summary>
        public UserType UserType { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public CommonEnum.IsLocked IsLocked { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public CommonEnum.IsDeleted IsDeleted { get; set; }

        /// <summary>
        /// 
        /// </summary>
        [Column(TypeName = "datetime")]
        public DateTime CreateOn { get; set; }

        /// <summary>
        /// 
        /// </summary>
        [Column(TypeName = "nvarchar(100)")]
        public string CreatedByUserId { get; set; }

        /// <summary>
        /// 
        /// </summary>
        [Column(TypeName = "nvarchar(50)")]
        public string CreatedByUserName { get; set; }

        /// <summary>
        /// 
        /// </summary>
        [Column(TypeName = "nvarchar(100)")]
        public string RegGroupId { get; set; }

        /// <summary>
        /// 
        /// </summary>
        [Column(TypeName = "nvarchar(50)")]
        public string RoleCode { get; set; }

        /// <summary>
        /// Gets or sets 是否自定义权限.
        /// </summary>
        [Column(TypeName = "int")]
        public int IsDefinedPermisson { get; set; }

        /// <summary>
        /// 描述/备注.
        /// </summary>
        [Column(TypeName = "nvarchar(255)")]
        public string? Description { get; set; }

        /// <summary>
        /// 
        /// </summary>
        [Column(TypeName = "nvarchar(100)")]
        public string DepId { get; set; }

        /// <summary>
        /// Gets or sets 用户组别.
        /// </summary>
        [Column(TypeName = "nvarchar(50)")]
        public string GroupType { get; set; }

        /// <summary>
        /// Gets or sets 产品组.
        /// </summary>
        [Column(TypeName = "nvarchar(50)")]
        public string? ProductGroup { get; set; }
    }


    /// <summary>
    /// 用户类型
    /// </summary>
    public enum UserType
    {
        /// <summary>
        /// 超级管理员 顶级用户
        /// </summary>
        SuperAdministator = 0,
        /// <summary>
        /// 一级用户、管理员
        /// </summary>
        PrimaryUser = 1,
        /// <summary>
        /// 一般用户、主管
        /// </summary>
        GeneralUser = 2,
        /// <summary>
        /// 三级用户、组长
        /// </summary>
        TertiaryUser = 3,
        /// <summary>
        /// 四级用户、组员
        /// </summary>
        FourLevelUser = 4,

    }

    /// <summary>
    /// 用户状态.
    /// </summary>
    public enum XinjeUserStatus
    {
        /// <summary>
        /// 未指定
        /// </summary>
        All = -1,

        /// <summary>
        /// 正常
        /// </summary>
        Normal = 1,

        /// <summary>
        /// 已禁用
        /// </summary>
        Forbidden = 2,

        /// <summary>
        /// 删除.
        /// </summary>
        Delete = 3,
    }

}
